package com.bidianying.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;


public class LoadProperties {

	private static Properties prop = null;

	/**
	 * 读取属性文件
	 */
	private synchronized static void loadProperties(String propFileName) {
		prop = new Properties();
		try {
			InputStream input = LoadProperties.class
					.getResourceAsStream(propFileName);
			prop.load(input);
		} catch (IOException e) {
		}
	}
	/**
	 * 
	 * @param propFileName
	 * @param propName
	 * @return
	 */
	public static String getProperty(String propFileName,String propName) {
		loadProperties(propFileName);
		return prop.getProperty(propName).trim();
	}

	public void setProperty(String propFileName,String propKey, String value) {
		loadProperties(propFileName);
		prop.setProperty(propKey, value);
	}

}
